Add pf_memory field
authorAaron Schulz <aaron@users.mediawiki.org>
Tue, 29 Apr 2008 11:59:10 +0000 (11:59 +0000)
committerAaron Schulz <aaron@users.mediawiki.org>
Tue, 29 Apr 2008 11:59:10 +0000 (11:59 +0000)
includes/Profiler.php
maintenance/archives/patch-profiling.sql

index b1f9b7a..86b4f45 100644 (file)
@@ -271,7 +271,7 @@ class Profiler {
 
                        global $wgProfileToDatabase;
                        if ($wgProfileToDatabase) {
-                               Profiler :: logToDB($fname, (float) ($elapsed * 1000), $calls);
+                               Profiler :: logToDB($fname, (float) ($elapsed * 1000), $calls, (float) ($memory * 1000) );
                        }
                }
                $prof .= "\nTotal: $total\n\n";
@@ -300,7 +300,7 @@ class Profiler {
        /**
         * @static
         */
-       function logToDB($name, $timeSum, $eventCount) {
+       function logToDB($name, $timeSum, $eventCount, $memory) {
                # Do not log anything if database is readonly (bug 5375)
                if( wfReadOnly() ) { return; }
 
@@ -323,7 +323,7 @@ class Profiler {
                        $pfhost = '';
                }
 
-               $sql = "UPDATE $profiling "."SET pf_count=pf_count+{$eventCount}, "."pf_time=pf_time + {$timeSum} ".
+               $sql = "UPDATE $profiling "."SET pf_count=pf_count+{$eventCount}, pf_time=pf_time+{$timeSum}, pf_memory=pf_memory+{$memory} ".
                        "WHERE pf_name='{$encname}' AND pf_server='{$pfhost}'";
                $dbw->query($sql);
 
index bafd2b6..84464e8 100644 (file)
@@ -4,6 +4,7 @@
 CREATE TABLE /*$wgDBprefix*/profiling (
   pf_count int NOT NULL default 0,
   pf_time float NOT NULL default 0,
+  pf_memory float NOT NULL default 0,
   pf_name varchar(255) NOT NULL default '',
   pf_server varchar(30) NOT NULL default '',
   UNIQUE KEY pf_name_server (pf_name, pf_server)